import {observable, action} from "mobx";

class ActivityModel {
    store;
    id;
    @observable name;
    @observable leader;
    @observable time;
    @observable deadline;
    @observable address;
    @observable participants;
    @observable partnum;
    @observable wechat;
    @observable lphone;
    @observable plan;
    @observable type;//活动种类
    @observable status;//活动审核状态，0 待审核，1 通过，2 未通过

    constructor(store, id, name, leader, time, deadline, address, participants, partnum, wechat, lphone, plan, type, status) {
        this.store = store;
        this.id = id;
        this.name = name;
        this.leader = leader;
        this.time = time;
        this.deadline = deadline;
        this.address = address;
        this.participants = participants;
        this.partnum = partnum;
        this.wechat = wechat;
        this.lphone = lphone;
        this.plan = plan;
        this.type = type;
        this.status = status;
    }

    static fromJS(store, object) {
        return new ActivityModel(
            store,
            object.id,
            object.name,
            object.leader,
            object.time,
            object.deadline,
            object.address,
            object.participants,
            object.partnum,
            object.wechat,
            object.lphone,
            object.plan,
            object.type,
            object.status
        );
    }

    @action updateFromJS(json) {
        this.name = json.name;
        this.leader = json.leader;
        this.time = json.time;
        this.deadline = json.deadline;
        this.address = json.address;
        this.participants = json.participants;
        this.partnum = json.partnum;
        this.wechat = json.wechat;
        this.lphone = json.lphone;
        this.plan = json.plan;
        this.type = json.type;
        this.status = json.status;
    }
}

export default ActivityModel;